<template>
  <div>
    <vol-box
      :model.sync="model"
      :padding="30"
      :title="title"
      :width="1000"
      :height="350"
    >
      <VolForm
        ref="myform"
        :loadKey="loadKey"
        :formFileds="formFileds"
        :formRules="formRules"
        :labelWidth="140"
      ></VolForm>

      <div slot="footer">
        <!-- <Button type="success" size="large" @click="addClick">保存</Button> -->
        <Button
          type="info"
          size="large"
          icon="md-close"
          @click="
            () => {
              this.model = false;
              this.$refs.myform.reset();
            }
          "
          >关闭</Button
        >
      </div>
    </vol-box>
  </div>
</template>
<script>
import VolForm from "@/components/basic/VolForm.vue";
export default {
  components: {
    VolBox: () => import("@/components/basic/VolBox.vue"),
    VolForm
  },
  props: {
    searchRow: {
    	// 定义接收的类型 还可以定义多种类型 [String, Undefined, Number]
    	// 如果required为true,尽量type允许undefined类型，因为传递过来的参数是异步的。或者设置默认值。
		// type: String,
		// 定义是否必须传
		required: true,
		// 定义默认值
		default: '暂无'
	},
  },
  data() {
    return {
      isAlias: false, //应收帐户编号是否可用
      alias: "", //编辑储存账户编号
      loadKey: true,
      model: false,
      formFileds: {
        customerName: "",
        customerPhone: "",
        complaintContent: "",
        complaintStatus: "",
        auditStatus:"",
        imgUrl: "",
        isRead: "",
        isRef: ""
      },
      formRules: [
        [
          {
            title: "顾客姓名",
            required: true,
            field: "customerName",
            type: "text",
            readonly:true,
            colSize: 4
          },
          {
            title: "顾客联系电话",
            required: true,
            field: "customerPhone",
            type: "text",
            readonly:true,
            colSize: 4
          },
          {
            title: "处理状态",
            field: "complaintStatus",
            data: [{ key: 1, value: "已处理" }, { key: 2, value: "未处理" }],
            type: "select",
            readonly:true,
            colSize: 4
          }
        ],
        [
          { title: "反馈图片",  field: "imgUrl", type: "img",
          // maxSize: 5,
          url: "/api/App_Appointment/Upload"},
          {
            title: "是否已读",
            required: true,
            data: [{ key: 0, value: "是" }, { key: 1, value: "否" }],
            field: "isRead",
            type: "select",
            readonly:true,
          },
          {
            title: "是否回复",
            required: true,
            data: [{ key: 0, value: "是" }, { key: 1, value: "否" }],
            field: "isRef",
            type: "select",
            readonly:true,
          }
        ],
        [
          {
            title: "审核状态",
            field: "auditStatus",
            required: true,
            data: [
              { key: 0, value: "审核中" },
              { key: 1, value: "审核通过" },
              { key: 2, value: "审核未通过" }
            ],
            type: "select",
            readonly:true,
            colSize: 3
          },
          {
            title: "反馈内容",
            field: "complaintContent",
            type: "textarea",
            readonly:true,
            colSize: 9
          }
        ]
      ],
      title: "",
      // 变量
      variable: ""
    };
  },
  watch: {},
  created() {},
  methods: {
    open(e) {
      console.log(this.searchRow,"this.searchRow")
      this.variable = e;
      this.title = this.variable == 0 ? "投诉管理--查看" : "投诉管理--查看";
      this.formReset();
      if(this.searchRow==""){
        this.$Message.error("请选择要查看的行!")
        return false
      }else{
        this.model = true;
        this.formFileds.customerName=this.searchRow.customerName
        this.formFileds.customerPhone= this.searchRow.customerPhone
        this.formFileds.complaintStatus= this.searchRow.complaintStatus
        this.formFileds.isRead= this.searchRow.isRead
        this.formFileds.isRef= this.searchRow.isRef
        this.formFileds.auditStatus= this.searchRow.auditStatus
        this.formFileds.complaintContent=this.searchRow.complaintContent
        this.formFileds.imgUrl=this.searchRow.imgUrl

      }
    },
    // 清空表单
    formReset() {
      this.$refs.myform.reset();
    },
  }
};
</script>
<style lang="less" scoped>
h3 {
  font-weight: 500;
  > span:last-child {
    margin-left: 30px;
  }
}
</style>
